import VConsole from "vconsole";
import { VITE_PAGE_SPY_URL } from "../env";

if (process.env.NODE_ENV === "development") {
  // 开发环境下使用 vconsole
  new VConsole();


  // 配置pagespy
  if (VITE_PAGE_SPY_URL) {
    const script = document.createElement("script");
    script.src = `${VITE_PAGE_SPY_URL}/page-spy/index.min.js`;
    script.async = true;
    script.onload = () => {
      // window.$harbor = new DataHarborPlugin();
      // window.$rrweb = new RRWebPlugin();

      // [window.$harbor, window.$rrweb].forEach(p => {
      //   PageSpy.registerPlugin(p)
      // })

      window.$pageSpy = new PageSpy({
        serializeData: true,
        autoRender: false,
      });
    };
    document.body.appendChild(script);
  }
}
